package cn.dglydrpy.study.common.routingDataSource;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class RoutingAspect {


	@Around("@annotation(routingWith)")
	public Object routingWithDataSource(ProceedingJoinPoint joinPoint,RoutingWith routingWith) throws Throwable {
		// mysql
		String key = routingWith.value();
		RoutingDataSourceContext routingDataSourceContext = new RoutingDataSourceContext(key);
		return  joinPoint.proceed();
	}
}
